#include "Processbar.h"
#include <unistd.h>

double bandwidth = 1024*1024*1.0;
//download
void download(double filesize,callback_t cb)
{
  //double filesize = 100*1024*1024*1.0;
  double current = 0.0;

  printf("download begin,current:%lf\n",current);
  while(current <= filesize)
  {
    cb(filesize,current);
    //从网络中获取
    current += bandwidth;
    usleep(10000);
  }
  printf("\ndownload done,filesize:%lf\n",filesize);
}


int main()
{
  //Fortest();
  //Process(100.0,56.9);
  //process(100.0,36.0);
  //Process(100.0,99.9);
  download(100*1024*1024,Process);
  download(50*1024*1024,Process);
  download(80*1024*1024,Process);
  download(1*1024*1024,Process);
  download(18*1024*1024,Process);
  return 0;
}
